package ltd.hxya.novel.book.controller;


import io.swagger.v3.oas.annotations.Operation;
import ltd.hxya.novel.book.dto.HomeBookRespDto;
import ltd.hxya.novel.book.service.BookInfoService;
import ltd.hxya.novel.book.service.HomeBookService;
import ltd.hxya.novel.book.service.IBookIndexService;
import ltd.hxya.novel.book.utils.resp.RestResp;
import ltd.hxya.novel.common.bean.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页home，前端的处理过程
 * </p>
 *
 * @author zww
 * @since 2022-09-13
 */
@RestController
@RequestMapping("/book/home")
public class HomeBookController {

    @Autowired
    private HomeBookService homeBookService;

    @Autowired
    private BookInfoService bookInfoService;

    /**
     * 首页小说推荐查询接口
     * 这个是直接处理3个页面的，前面两个热门推荐，本周强推
     * @return
     */
    @Operation(summary = "首页小说推荐查询接口")
    @GetMapping("books")
    public Result<List<HomeBookRespDto>> listHomeBooks() {
        List<HomeBookRespDto> homeBookRespDtos =bookInfoService.listHomeBooks();
        return Result.success(homeBookRespDtos);
    }
}
